//
// Created by longyunbo on 6/23/21.
//

#ifndef ANALYSIS_CODEATTRIBUTEINFO_H
#define ANALYSIS_CODEATTRIBUTEINFO_H
#include "map"
//#include "BytecodeStream.h"

class BytecodeStream;
class AttributeInfo;

#define PropertyBuilderByName(type, name, access_permission)\
access_permission:\
    type m_##name;\
public:\
inline void set##name(type v) {\
    m_##name = v;\
}\
inline type get##name() {\
    return m_##name;\
}\

using namespace std;

struct CodeAttributeInfo {

    int* _attributeNameIndex;
    void set_attributeNameIndex( int* value );
    int* get_attributeNameIndex();

    int* _attributeLength;
    void set_attributeLength( int* value );
    int* get_attributeLength();

    int* _maxStack;
    void set_maxStack( int* value );
    int* get_maxStack();

    int* _maxlocals;
    void set_maxlocals( int* value );
    int* get_maxlocals();

    int _codeLength;


public:
    int get_codeLength();
    void set_codeLength(int codeLenght);

    BytecodeStream* _code;
    void setBytecodeStream(BytecodeStream* value);
    BytecodeStream* get_code();

    int* _exceptionTableLength;
    void set_exceptionTableLength( int* value );
    int* get_exceptionTableLength();

    // 如局部变量表、操作数栈
    int* _attributesCount;
    void set_attributesCount( int* value );
    int* get_attributesCount();

    map <int , AttributeInfo*>  _attributes;
    map <int , AttributeInfo*> get_attributes();
    void set_attributes( map <int , AttributeInfo*> value );


    ~CodeAttributeInfo();

};


#endif //ANALYSIS_CODEATTRIBUTEINFO_H
